#ifndef KUOZHANGTABLEWIDGET_H
#define KUOZHANGTABLEWIDGET_H

#include <QTableWidget>
#include "bean/kuozhangbean.h"

class KuoZhangTableWidget : public QTableWidget
{
    Q_OBJECT
private :
    enum colType{
        numType = 0,
        groupCityType = 1,
        groupLocationType = 2,
        groupIndexType = 3,
        taskTotalType = 4,
        shortCityType = 5,
        deleteType = 6
    };


private:

    bool isCreateTableFinish();
public:
    explicit KuoZhangTableWidget(QWidget *parent = nullptr);
    void init();
    int creatNewRow(int num = 0, QString groupCity = "", QString groupXiaoWeiLocation = "", int groupIndex = 0, int taskTotal = 50, QString shortCityName = "洛阳");
    QList<KuoZhangBean> readKuoZhangByFile();
    bool saveBeans2File();
    bool getBean(int row, KuoZhangBean *kuozhang, bool isNeedFindPath = false);
    bool getAllTableBeans(QList<KuoZhangBean*> *allKuoZhangBeans = nullptr, bool isNeedFindPath = false);

signals:
    void logEvent(QString log);
};

#endif // KUOZHANGTABLEWIDGET_H
